package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "pcs_complain")
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_complain" + StatusUtil.SLICE_DELETE) //
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("投诉")
public class Complain implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "ID", type = ExcelType.EXPORT)
    private Long id;

    @CreatedDate
    @Excel("创建时间")
    private Date createTime;

    @Transient
    private String createTimeStr;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @Excel("订单号")
    private String sn; // 新增字段

    @Excel("投诉图片")
    private String pics;

    @Excel("患者ID")
    private Long patientId; // 新增字段

    @Excel("服务的护工ID")
    private Long porterId; // 新增字段
    @Excel("护理公司ID")
    private Long companyId; // 新增字段

    @Excel("姓名")
    private String name; // 新增字段

    @Excel("性别 1 男 2 女")
    private Byte sex; // 新增字段

    @Excel("身份证号")
    private String cardNo; // 新增字段

    @Excel("年龄")
    private Integer age; // 新增字段

    @Excel("头像")
    private String headimg; // 新增字段

    @Excel("备注")
    private String remark; // 新增字段

    private Byte status = StatusEnum.OK.getCode(); // 新增字段

    @Transient
    private List<String> picsList = new ArrayList<>();
    @Transient
    private int serviceNum;
}
